<?php

/**
* Question form.
*
* @package    docplus.co.za
* @subpackage form
* @author     Fox Matuku
* @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class AnonymousQuestionForm extends BaseQuestionForm
{
    public function configure()
    {                
        unset(
        $this['created_at'], $this['updated_at']
        );

        $this->widgetSchema['enquiry']->setAttribute("title", "Ask a new question...");
		$this->widgetSchema['email'] = new sfWidgetFormInputText(array(), array());
		$this->widgetSchema['friend_email'] = new sfWidgetFormInputText(array(), array());        
        $this->widgetSchema['user_id'] = new sfWidgetFormInputHidden();
        
        $this->validatorSchema['email'] = new sfValidatorEmail(array("required" => true), array("invalid" => "Your *email* is invalid.", "required" => "Your *email* is required."));
        $this->validatorSchema['friend_email'] = new sfValidatorEmail(array("required" => false), array("invalid" => "Your *email* is invalid."));
        $this->validatorSchema['enquiry'] = new sfValidatorString(array('max_length' => 150, 'required' => true), array('required' => 'Your *question* is required.', 'max_length' => 'Only 150 characters allowed!'));
        $this->validatorSchema['user_id'] = new sfValidatorEmail(array("required" => false));
        
        $this->widgetSchema['email']->setLabel("Your email (mandatory)");
        $this->widgetSchema['friend_email']->setLabel("Friend email (optional)");

        $this->widgetSchema->setNameFormat('anonymous_question[%s]');
    }
}
